package cn.msi.question.action;

import cn.common.action.GeneralAction;
import cn.msi.question.domain.Question;
import cn.msi.question.service.QuestionService;

public class QuestionAction extends GeneralAction {

	private static final long serialVersionUID = 5728894611896429306L;

	private Question question = new Question();

	private String tableId;

	private String ids;

	private QuestionService questionService;

	/**
	 * 查询样题库
	 * 
	 * @throws Exception
	 */
	public void searchQuestion() throws Exception {
		page(question);
		String json = questionService.searchQuestion(question);
		out(json);
	}

	/**
	 * 查找样题
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findQuestion() throws Exception {
		question = questionService.findQuestion(question);
		return SUCCESS;
	}

	/**
	 * 编辑样题
	 * 
	 * @throws Exception
	 */
	public void modifyQuestion() throws Exception {
		questionService.modifyQuestion(question);
	}

	/**
	 * 删除样题
	 * 
	 * @throws Exception
	 */
	public void delQuestion() throws Exception {
		questionService.delQuestion(question);
	}

	/**
	 * 选择样题界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public String selectQuestionIndex() throws Exception {
		return SUCCESS;
	}

	/**
	 * 根据ID查询样题
	 * 
	 * @throws Exception
	 */
	public void searchQuestionByIds() throws Exception {
		String json = questionService.searchQuestionByIds(ids);
		out(json);
	}

	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	public void setQuestionService(QuestionService questionService) {
		this.questionService = questionService;
	}

	public String getTableId() {
		return tableId;
	}

	public void setTableId(String tableId) {
		this.tableId = tableId;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}
}
